<?Lassoscript
// Last modified 11/30/09 by Eric Landmann

// FUNCTIONALITY
// This is the form that is included to add or edit members
// Action = Add means request came from the "Add a Member" page
// Action = Edit means request came from the "Edit my Profile" page
// ResponsePage is used to change the response page depending on if it is an add or edit
// ActionLabel is used for the button text on the form submit button

// DEVELOPER'S NOTES
// This page has a very odd problem of not converting the action_param Error to a var
// Have no idea why it's not working

// CHANGE NOTES
// 4/17/09
// Version 1.0
// 11/30/09
// Worked on Admin.

Var:'vAction' = string;
Var:'ResponsePage' = string;
Var:'ActionLabel' = string;

// Debugging
// Var:'svDebug' = 'Y';

// Determining if it is an add or edit page
If: (Response_Filepath) >> 'm_add2.lasso';
	$vAction = 'Add';
	$ResponsePage = 'm_addresponse.lasso';
	$ActionLabel = 'Add';
Else: (Response_Filepath) >> 'm_update.lasso';
	$vAction = 'Edit';
	$ResponsePage = 'm_updateresponse.lasso';
	$ActionLabel = 'Update';
// Else somebody is screwing with us, dump them to Index page with error 5012 "Access Denied" error
Else;
	$vAction = 'Invalid';
	$vError = '5012';
/If;

// If action is invalid, immediately redirect to index page
If: $vAction == 'Invalid';
	Var:'URL' = ('forums.lasso?Error='($vError));
	If: $svDebug == 'Y';
		Debug;
			'24: URL = ' $URL '<br>\n';
			'<a href="'$URL'"><br>';
		/Debug;
	Else;
		Redirect_URL: $URL;
	/If;
/If;

Debug;
	'55: Response_Filepath = ' (Response_Filepath) '<br>\n';
	'55: vAction = ' $vAction '<br>\n';
	'55: ResponsePage = ' $ResponsePage '<br>\n';
	'55: ActionLabel = ' $ActionLabel '<br>\n';
	'55: vError = ' $vError '<br>\n';
	'55: vOption = ' $vOption '<br>\n';
/Debug;

?><div align="center">
<form action="[$ResponsePage]" method="post">      
<table border="0" cellpadding="5" width="600">
	<tr bgcolor="#FFFFFF">
		<td colspan="2"><h2>Member Profile</h2>
		<p><strong>NOTE: </strong>Fields marked with [$svInputRequired] are required.</p></td>
	</tr>
<?Lassoscript

// Standard Error Table
If: (Var:'vError') != '';
	'\t<tr>\n';
	'\t\t<td colspan="2">\n';
	LI_ShowError3: -ErrNum=$vError, -Option=$vOption;
	'\t\t</td>\n';
	'\t</tr>\n';
/If;

// Output slightly different member name and member ID info depending on if it is add or edit
// This is because we do not allow editing of Name or Member IDs
If: $vAction == 'Edit';

?>	<tr>
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
			<div align="right"><strong>Member Photo</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
<?Lassoscript
// Display member photo if it exists, and Delete Photo link
Var:'PhotoName' = (($svSiteFolderRoot)'/member/'(Var:'svMemberID')'.jpg');
Var:'PhotoExists' = boolean(File_Exists:($PhotoName));
Debug;
	'\t\t\t87: PhotoName = ' $PhotoName '<br>\n';
	'\t\t\t87: PhotoExists = ' $PhotoExists '<br>\n';
/Debug;
	If: (File_Exists:($PhotoName));
		'\t\t\t<img src="'($PhotoName)'" alt="Member Photo">&nbsp;<a href="delete_memberphoto.lasso?Member='($svMemberID)'">Delete Photo</a>\n';
	/If;
	If: (!File_Exists:($PhotoName));
		'\t\t\t\<a href="upload_memberphoto.lasso?Member='($svMemberID)'">Upload Photo</a>\n';
	/If;
?>
        </td>
	</tr>
	<tr> 
		<td width="200" bgcolor="[Var:'svSearchContentColor']"> 
			<div align="right"><strong>Name</strong></div>
		</td>
		<td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
			<input type="hidden" name="First_Name" value="[Var:'svFirst_Name']">
			<input type="hidden" name="Last_Name" value="[Var:'svLast_Name']">
			[Var:'svFirst_Name'] [Var:'svLast_Name']
        </td>
	</tr>
	<tr> 
		<td width="200" bgcolor="[Var:'svSearchContentColor']" align="left"> 
			<div align="right"><strong>Post Names</strong><br>
			All post names are public</div>
		</td>
		<td valign="top" bgcolor="[Var:'svPostContentColor']" align="left">
[If: (Var:'svPost_Name1')=='']
       <input type="text" name="Post_Name1" value="[Var:'svPost_Name1']" size="18">
       &nbsp;&nbsp;&nbsp;<font color="red">&lt;-- First Post Name</font><br>
[Else]
		<input type="hidden" name="Post_Name1" value="[Var:'svPost_Name1']">
        [Var:'svPost_Name1']&nbsp;&nbsp;&nbsp;<font color="red">&lt;-- First Post Name</font><br>
[/If]
[If: (Var:'svPost_Name2')=='']
       <input type="text" name="Post_Name2" value="[Var:'svPost_Name2']" size="18">
       &nbsp;&nbsp;&nbsp;&lt;-- Second Post Name<br>
[Else]
		<input type="hidden" name="Post_Name2" value="[Var:'svPost_Name2']">
        [Var:'svPost_Name2']&nbsp;&nbsp;&nbsp;&lt;-- Second Post Name<br>
[/If]
[If: (Var:'svPost_Name3')=='']
       <input type="text" name="Post_Name3" value="[Var:'svPost_Name3']" size="18">
       &nbsp;&nbsp;&nbsp;&lt;-- Third Post Name<br>
[Else]
		<input type="hidden" name="Post_Name3" value="[Var:'svPost_Name3']">
        [Var:'svPost_Name3']&nbsp;&nbsp;&nbsp;&lt;-- Third Post Name<br>
[/If]
[If: (Var:'svPost_Name4')=='']
       <input type="text" name="Post_Name4" value="[Var:'svPost_Name4']" size="18">
       &nbsp;&nbsp;&nbsp;&lt;-- Fourth Post Name<br>
[Else]
		<input type="hidden" name="Post_Name4" value="[Var:'svPost_Name4']">
        [Var:'svPost_Name4']&nbsp;&nbsp;&nbsp;&lt;-- Fourth Post Name<br>
[/If]
[If: (Var:'svPost_Name5')=='']
       <input type="text" name="Post_Name5" value="[Var:'svPost_Name5']" size="18">
	  &nbsp;&nbsp;&nbsp;&lt;-- Fifth Post Name<br>

[Else]
		<input type="hidden" name="Post_Name5" value="[Var:'svPost_Name5']">
        [Var:'svPost_Name5']&nbsp;&nbsp;&nbsp;&lt;-- Fifth Post Name<br>
[/If]
        </td>
      </tr>
<?Lassoscript
// Output this if it is an Add action
Else: $vAction == 'Add';
?>
	<tr> 
		<td width="200" bgcolor="[Var:'svSearchContentColor']"> 
			<div align="right"><strong>First Name[$svInputRequired]</strong></div>
		</td>
		<td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
			<input type="text" name="First_Name" value="" size="15">
		</td>
	</tr>
	<tr> 
		<td width="200" bgcolor="[Var:'svSearchContentColor']"> 
			<div align="right"><strong>Last Name[$svInputRequired]</strong></div>
		</td>
		<td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
			<input type="text" name="Last_Name" value="" size="20">
		</td>
	</tr>
	<tr> 
		<td width="200" bgcolor="[Var:'svSearchContentColor']"> 
			<div align="right"><strong>Post Names</strong><br>
			All post names are public</div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
			<input type="text" name="Post_Name1" value="[Var:'svPost_Name1']" size="18" maxlength="24">
				&nbsp;&nbsp;&nbsp;<font color="red">&lt;-- First Post Name</font>[$svInputRequired]<br>
			<input type="text" name="Post_Name2" value="[Var:'svPost_Name2']" size="18" maxlength="24">
				&nbsp;&nbsp;&nbsp;&lt;-- Second Post Name<br>
			<input type="text" name="Post_Name3" value="[Var:'svPost_Name3']" size="18" maxlength="24">
				&nbsp;&nbsp;&nbsp;&lt;-- Third Post Name<br>
			<input type="text" name="Post_Name4" value="[Var:'svPost_Name4']" size="18" maxlength="24">
				&nbsp;&nbsp;&nbsp;&lt;-- Fourth Post Name<br>
			<input type="text" name="Post_Name5" value="[Var:'svPost_Name5']" size="18" maxlength="24">
				&nbsp;&nbsp;&nbsp;&lt;-- Fifth Post Name
        </td>
      </tr>
[/If]
      <tr> 
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>Password[$svInputRequired]</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
        <input type="text" name="Pass" value="[Var:'svPass']" size="10" maxlength="12">
        </td>
      </tr>
      <tr> 
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>E-mail[$svInputRequired]</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
			<input type="text" name="Mail" value="[Var:'vMail']" size="30" maxlength="128">
        </td>
      </tr>
      <tr> 
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>Home/Favorite Crag[$svInputRequired]</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
			<input type="text" name="Fav_Crag" value="[Var:'vFav_Crag']" size="39" maxlength="128">
        </td>
      </tr>
      <tr> 
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>Address[$svInputRequired]</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
			<input type="text" name="Address" value="[Var:'vAddress']" size="39">
        </td>
      </tr>
      <tr> 
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>City, State/Province, Zip/Postal Code[$svInputRequired]</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
			<input type="text" name="City" value="[Var:'vCity']" size="22">
[Include:(($svSiteFolderRoot)'/includes/selectlist_stateprov.inc')]
        <input type="text" name="Zip" value="[Var:'vZip']" size="8">
        </td>
      </tr>
      <tr> 
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>Country[$svInputRequired]</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
            <SELECT NAME="Country">
            <option value="USA" [If:(Var:'vCountry')=='USA'] Selected[/If]>USA</option>
			<option value="Canada" [If:(Var:'vCountry')=='Canada'] Selected[/If]>Canada</option>
			<option value="Other" [If:(Var:'vCountry')=='Other'] Selected[/If]>Other</option>
		</select>
        </td>
      </tr>      
      <tr>
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>Phone[$svInputRequired]</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
        <input type="text" name="Phone" value="[Var:'vPhone']" size="16">
        </td>
      </tr>
      <tr> 
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>Favorite URL[$svInputRequired]</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
        <input type="text" name="Fav_URL" value="[Var:'vFav_URL']" size="39">
        </td>
      </tr>
      <tr> 
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>Sex</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
      		<select name="Sex">
			  <option value="Male"[If:(Var:'vSex')=='Male'] Selected[/If]>Male</option>
			  <option value="Female"[If:(Var:'vSex')=='Female'] Selected[/If]>Female</option>
			</select>
        </td>
      </tr>    
       
      <tr> 
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>Year Born</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
[Include:(($svSiteFolderRoot)'/includes/selectlist_year.inc')]
		</td>
      </tr>
     <tr>  
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>Type[$svInputRequired]</strong><br>
          Click all that apply</div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left">
		<input type="checkbox" name="Type" value="1"[If:(Var:'vType')=='1'] Checked[/If]>Type 1<br>
		<input type="checkbox" name="Type" value="2"[If:(Var:'vType')=='2'] Checked[/If]>Type 2<br>
		<input type="checkbox" name="Type" value="3"[If:(Var:'vType')=='3'] Checked[/If]>Type 3<br>
		<input type="checkbox" name="Type" value="4"[If:(Var:'vType')=='4'] Checked[/If]>Type 4<br>
        </td>
      </tr>  
      <tr> 
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>Ability[$svInputRequired]</strong></div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
      		<select name="Ability">
 			  <option value="1"[If:(Var:'vAbility')=='1'] selected[/If]>1</option>
 			  <option value="2"[If:(Var:'vAbility')=='2'] selected[/If]>2</option>
 			  <option value="3"[If:(Var:'vAbility')=='3'] selected[/If]>3</option>
 			  <option value="4"[If:(Var:'vAbility')=='4'] selected[/If]>4</option>
			</select>
		</td>
	</tr>    
	<tr> 
		<td width="200" bgcolor="[Var:'svSearchContentColor']"> 
			<div align="right"><strong>Notable Achievements</strong></div>
		</td>
		<td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
			<textarea name="Achieve" cols="50" rows="4">[Var:'vAchieve']</textarea>
		</td>
	</tr>
	<tr> 
		<td width="200" bgcolor="[Var:'svSearchContentColor']"> 
			<div align="right"><strong>Personal Statement</strong></div>
		</td>
		<td valign="top" bgcolor="[Var:'svPostContentColor']" align="left"> 
			<textarea name="Statement" cols="50" rows="3">[Var:'vStatement']</textarea>
		</td>
	</tr>
     <tr>  
        <td width="200" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="right"><strong>E-mail Preferences</strong><br>
          Receive e-mail notifications of <strong>new topic</strong> posts in these Forums (you always can request e-mail notification in an individual topic, even if these are disabled):</div>
        </td>
        <td valign="top" bgcolor="[Var:'svPostContentColor']" align="left">
			<table>
				<tr>
					<td width="200">Forum 1</td>
					<td align="left">
						<input type="radio" name="Email_Forum1" value="Y"[If:(Var:'vEmail_Forum1')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum1" value="N"[If:(Var:'vEmail_Forum1')=='N'] checked[/If]>No
					</td>
				</tr>
				<tr>
					<td width="200">Forum 2</td>
					<td align="left">
						<input type="radio" name="Email_Forum2" value="Y"[If:(Var:'vEmail_Forum2')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum2" value="N"[If:(Var:'vEmail_Forum2')=='N'] checked[/If]>No
					</td>
				</tr>
				<tr>
					<td width="200">Forum 3</td>
					<td align="left">
						<input type="radio" name="Email_Forum3" value="Y"[If:(Var:'vEmail_Forum3')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum3" value="N"[If:(Var:'vEmail_Forum3')=='N'] checked[/If]>No
					</td>
				</tr>
				<tr>
					<td width="200">Forum 4</td>
					<td align="left">
						<input type="radio" name="Email_Forum4" value="Y"[If:(Var:'vEmail_Forum4')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum4" value="N"[If:(Var:'vEmail_Forum4')=='N'] checked[/If]>No
					</td>
				</tr>
				<tr>
					<td width="200">Forum 5</td>
					<td align="left">
						<input type="radio" name="Email_Forum5" value="Y"[If:(Var:'vEmail_Forum5')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum5" value="N"[If:(Var:'vEmail_Forum5')=='N'] checked[/If]>No
					</td>
				</tr>
				<tr>
					<td width="200">Forum 6</td>
					<td align="left">
						<input type="radio" name="Email_Forum6" value="Y"[If:(Var:'vEmail_Forum6')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum6" value="N"[If:(Var:'vEmail_Forum6')=='N'] checked[/If]>No
					</td>
				</tr>
				<tr>
					<td width="200">Forum 7</td>
					<td align="left">
						<input type="radio" name="Email_Forum7" value="Y"[If:(Var:'vEmail_Forum7')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum7" value="N"[If:(Var:'vEmail_Forum7')=='N'] checked[/If]>No
					</td>
				</tr>
				<tr>
					<td width="200">Forum 8</td>
					<td align="left">
						<input type="radio" name="Email_Forum8" value="Y"[If:(Var:'vEmail_Forum8')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum8" value="N"[If:(Var:'vEmail_Forum8')=='N'] checked[/If]>No
					</td>
				</tr>
				<tr>
					<td width="200">Forum 9</td>
					<td align="left">
						<input type="radio" name="Email_Forum9" value="Y"[If:(Var:'vEmail_Forum9')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum9" value="N"[If:(Var:'vEmail_Forum9')=='N'] checked[/If]>No
					</td>
				</tr>
				<tr>
					<td width="200">Forum 10</td>
					<td align="left">
						<input type="radio" name="Email_Forum10" value="Y"[If:(Var:'vEmail_Forum10')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum10" value="N"[If:(Var:'vEmail_Forum10')=='N'] checked[/If]>No
					</td>
				</tr>
				<tr>
					<td width="200">Forum 11</td>
					<td align="left">
						<input type="radio" name="Email_Forum11" value="Y"[If:(Var:'vEmail_Forum11')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum11" value="N"[If:(Var:'vEmail_Forum11')=='N'] checked[/If]>No
					</td>
				</tr>
				<tr>
					<td width="200">Forum 12</td>
					<td align="left">
						<input type="radio" name="Email_Forum12" value="Y"[If:(Var:'vEmail_Forum12')=='Y'] checked[/If]>Yes
						<input type="radio" name="Email_Forum12" value="N"[If:(Var:'vEmail_Forum12')=='N'] checked[/If]>No
					</td>
				</tr>

			</table>
        </td>
      </tr>  
	<tr> 
		<td colspan="2" bgcolor="[Var:'svSearchContentColor']"> 
          <div align="center">
            <input type="submit" name="-Nothing" value="[$ActionLabel]">
            </div>
        </td>
	</tr>
    </table>
</form>
</div>
